home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of NeuroSolutions Synapse component
-
- #include "NSDLL.h"
-
- /*************************************************/
- /* Macros to access the PE layers in matrix form */
-
- #define in(i,j) input[j+i*inCols]
- #define out(i,j) output[j+i*inCols]
-
- /***********************************/
- /* Forward activation of component */
-
- __declspec(dllexport) void performSynapse(
- DLLData *instance, // Pointer to instance data (may be NULL)
- NSFloat *input, // Pointer to the input layer of processing elements (PEs)
- int inRows, // Number of rows of PEs in the input layer
- int inCols, // Number of columns of PEs in the input layer
- NSFloat *output, // Pointer to the output layer
- int outRows, // Number of rows of PEs in the output layer
- int outCols // Number of columns of PEs in the output layer
- )
- {
- int i,
- inCount=inRows*inCols,
- outCount=outRows*outCols,
- count = inCount<outCount? inCount: outCount;
-
- for (i=0; i<count; i++)
- output[i] += input[i];
- }
-
- /******************************************/
- /* Management of instance data (OPTIONAL) */
- /*
- __declspec(dllexport) DLLData *allocSynapse(
- DLLData *oldInstance, // Pointer to the last instance if reallocating
- int inRows, // Number of rows of PEs in the input layer
- int inCols, // Number of columns of PEs in the input layer
- int outRows, // Number of rows of PEs in the output layer
- int outCols // Number of columns of PEs in the output layer
- )
- {
- DLLData *instance = allocDLLInstance(oldInstance);
- return instance;
- }
-
- __declspec(dllexport) void freeSynapse(DLLData *instance)
- {
- freeDLLInstance(instance);
- }
- */
-